import { get, postGet } from "@/useHttp"

export const getDistinct = async (tblName: string, valueColumn: string, labelColumn: string, where: any = {}): Promise<{ value: string, label: string }[]> => {
  const { data } = await get<{ data: any[] }>('/api/' + tblName, where)
  return data.map((item: any) => ({
    value: item[valueColumn],
    label: item[valueColumn] + '(' + item[labelColumn] + ')',
  }));
}